/**
 * This file is a part of qloudgen-rul. 
 * You can redistribute qloudgen-rul and/or modify it under the terms of the Lesser GNU General Public License version 3. 
 * qloudgen-rul is distributed WITHOUT ANY WARRANTY. 
 *
 * See the Lesser GNU General Public License for more details at http://www.gnu.org/licenses/. 
 **/
package org.qloudgen.rul.guvnor.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextListener;

/**
 * @author mike
 */
public class M2PropertiesListener implements ServletContextListener {
	/**
	 *
	 */
	private String M2REPO_DIR = null;
	
	/**
	 * Initialized.
	 */
	public void contextInitialized(ServletContextEvent event) {
		//
		M2REPO_DIR = event.getServletContext().getInitParameter( "org.guvnor.m2repo.dir" );
    	/**
    	 * @see org.guvnor.m2repo.backend.server.GuvnorM2Repository
    	 */
		if ( M2REPO_DIR != null ) {
			System.setProperty( "org.guvnor.m2repo.dir" , M2REPO_DIR );
		}
	}
	
	/**
	 * Destroyed
	 */
	public void contextDestroyed(ServletContextEvent arg0) {
		// Nothing need todo.
	}
}